Skip to content

fix: use epoch fallback for entity lastModifiedTime#265

Merged
YunchuWang merged 2 commits into
mainfrom
copilot-finds/bug/fix-entity-lastmodifiedtime-default
Jun 12, 2026
Merged

fix: use epoch fallback for entity lastModifiedTime#265
YunchuWang merged 2 commits into
mainfrom
copilot-finds/bug/fix-entity-lastmodifiedtime-default

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

Fixes #240

Copilot AI review requested due to automatic review settings June 11, 2026 20:53
convertEntityMetadata() used new Date() (current time) as the default
when the proto lastModifiedTime field was missing. This is inconsistent
with _createOrchestrationStateFromProto(), which uses new Date(0) (Unix
epoch) for missing timestamps. The current-time default makes it
impossible for callers to distinguish between 'entity was just modified'
and 'entity has no known modification time'.

Changed the default to new Date(0) for consistency and correctness.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@YunchuWang YunchuWang force-pushed the copilot-finds/bug/fix-entity-lastmodifiedtime-default branch from 6c76e42 to f6be3fa Compare June 11, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes entity metadata timestamp conversion so missing lastModifiedTime values default to the Unix epoch (new Date(0)) instead of the current time, aligning entity behavior with existing orchestration timestamp defaults and preventing misleading “just modified” timestamps from appearing in client results.

Changes:

  • Updated TaskHubGrpcClient.convertEntityMetadata() to use an epoch fallback for missing lastModifiedTime.
  • Added tests intended to cover the epoch fallback and “timestamp present” behavior for entity metadata conversion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/durabletask-js/src/client/client.ts Changes the lastModifiedTime fallback to new Date(0) when the proto field is absent.
packages/durabletask-js/test/entity-client.spec.ts Adds new test cases around missing/present lastModifiedTime handling (currently re-implementing the logic rather than exercising production conversion).

Comment thread packages/durabletask-js/test/entity-client.spec.ts Outdated
Comment thread packages/durabletask-js/test/entity-client.spec.ts Outdated
Update entity metadata timestamp tests to call TaskHubGrpcClient.convertEntityMetadata instead of duplicating the fallback expression in the test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@YunchuWang YunchuWang merged commit 26cdc42 into main Jun 12, 2026
28 checks passed
@YunchuWang YunchuWang deleted the copilot-finds/bug/fix-entity-lastmodifiedtime-default branch June 12, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[copilot-finds] Bug: convertEntityMetadata() defaults missing lastModifiedTime to current time instead of epoch

4 participants